package com.example.springboot.service.impl;

import com.example.springboot.dao.UserDao;
import com.example.springboot.entity.User;
import com.example.springboot.service.UserService;

import java.util.Set;

/**
 * Created by tang on 2018/1/5.
 */
public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDao();

    @Override
    public User createUser(User user) {
        user = userDao.createUser(user);
        return user;
    }

    @Override
    public void changePassword(Long userId, String newPassword) {
        userDao.changePassword(userId, newPassword);

    }

    @Override
    public void correlationRoles(Long userId, Long... roleIds) {
        userDao.correlationRoles(userId, roleIds);
    }

    @Override
    public void uncorrelationRoles(Long userId, Long... roleIds) {

        userDao.uncorrelationRoles(userId, roleIds);
    }

    @Override
    public User findByUsername(String username) {
        return userDao.findByUsername(username);
    }

    @Override
    public Set<String> findRoles(String username) {
        return userDao.findRoles(username);
    }

    @Override
    public Set<String> findPermissions(String username) {
        return userDao.findPermissions(username);
    }
}
